package org.xteam.sled.semantic;

import java.util.ArrayList;
import java.util.List;

import org.xteam.parser.runtime.Span;
import org.xteam.sled.model.BasePattern;
import org.xteam.sled.semantic.exp.Exp;


public class TokenClass implements IDenotable {

	private int size;
	private String name;
	private List<Field> fields;

	public TokenClass(String name, int size) {
		this.name = name;
		this.size = size;
		this.fields = new ArrayList<Field>();
	}
	
	public String name() {
		return name;
	}
	
	public int size() {
		return size;
	}

	public void add(Field f) {
		fields.add(f);
	}

	public List<Field> getFields() {
		return fields;
	}
	
	public String toString() {
		return name + "(" + size + ")"; 
	}

	@Override
	public Exp projectInt(IEvaluationContext context, Span span) {
		context.reportError(span, "not an integer expression");
		return null;
	}

	@Override
	public BasePattern projectPattern(IEvaluationContext context, Span span) {
		context.reportError(span, "not an pattern expression");
		return null;
	}
}
